import moment from "moment";
import ps from "../../common/variable"
function checkActStatus(act) {
  console.log(act);
  let temp = act['msg'];
  let start = moment(temp.StartTime);
  let end = moment(temp.EndTime);
  let now = moment();
  //判断活动是否开始
  if (now.isBefore(start)) {
    return ps.AtActInActiveStart
  }
  //判断活动是否开始
  if (now.isAfter(end)) {
    return ps.AtActInActiveEnd
  }
  // 当用户是参与者进入自己页面时
  if(act.isJoiner && act.isPageJoin && act.checkPageJoin){
    return ps.JoinDone
  }
  //判断帮忙者是否参与过活动(帮忙者是参与者)
  if (act.isJoiner && act.isPageJoin && !act.checkPageJoin) {
    return ps.ParterDone
  }
  //判断帮忙者是否参与过活动(帮忙者不是参与者)
  if (act.isJoiner && !act.isPageJoin && !act.checkPageJoin) {
    return ps.ParterLook
  }
  return ps.JoinJustNow
}

export default checkActStatus;
